# -*- coding: utf-8 -*-
# @author: wch
# @file: ellipse.py
# @time: 2023/2/7 15:58

import numpy as np
import cv2

# 绘制椭圆
# ellipse(img,中心点，长宽的一半，顺时针旋转的角度，从哪个角度开始，从哪个角度结束（顺时针），.......)
img = cv2.imread(r"E:\code\opencv\media\image\0.jpg")
cv2.ellipse(img, (100, 100), (50, 30), 30, 20, 300, (0, 0, 255))
# cv2.imshow("img", img)
# cv2.waitKey(0)
# cv2.destroyAllWindows()

# 绘制多边形polylines(img,点集，是否闭环，颜色，......)
pts =np.array([(300,10),(150,100),(450,100)],np.int32)
cv2.polylines(img,[pts],True,(0,0,255),)


# 多边形的填充fillPoly(img,[pts],(255,0,0))
cv2.fillPoly(img,[pts],(255,0,0))


cv2.imshow("img", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

